﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Reflection;
using K.EnterpriseLibary.Entity;
namespace K.DLInterface
{
    public interface IChineseDict
    {
        bool InsertCharacterInfoProvenance(CharacterInfoProvenance characterInfoProvenance);
        bool UpdateCharacterInfoProvenancer(CharacterInfoProvenance characterInfoProvenance);
        bool DeleteCharacterInfoProvenance(CharacterInfoProvenance characterInfoProvenance);
        CharacterInfoProvenance SelectCharacterInfoProvenanceById(int id);
        List<CharacterInfoProvenance> SelectCharacterInfoProvenanceByAnyProperty(params object[] parameters);
        List<CharacterInfoProvenance> SelectCharacterInfoProvenanceByCharacterInfo(CharacterInfo characterInfo);
        bool DeleteCharacterInfoProvenance(CharacterInfo characterInfo);
        bool InsertArticle(Article article);
        bool UpdateArticle(Article article);
        bool DeleteArticle(Article article);
        Article SelectArticleById(int id);
        List<Article> SelectArticleByAnyProperty(params object[] parameters);
        bool InsertBook(Book book);
        bool UpdateBook(Book book);
        bool DeleteBook(Book book);
        Book SelectBookById(int id);
        List<Book> SelectBookByAnyProperty(params object[] parameters);
        bool InsertCharacter(Character character);
        bool UpdateCharacter(Character character);
        bool DeleteCharacter(Character character);
        Character SelectCharacterById(int id);
        List<Character> SelectCharacterByAnyProperty(params object[] parameters);
        Character SelectRandomCharacter();
        bool InsertCharacterInfo(CharacterInfo characterInfo);
        bool UpdateCharacterInfo(CharacterInfo characterInfo);
        bool DeleteCharacterInfo(CharacterInfo characterInfo);
        CharacterInfo SelectCharacterInforById(int id);
        List<CharacterInfo> SelectCharacterInfoByAnyProperty(params object[] parameters);
        List<CharacterInfo> SelectCharacterInfoByCharacter(Character character);
        bool InsertSoundMark(SoundMark soundMark);
        bool UpdateSoundMark(SoundMark soundMark);
        bool DeleteSoundMark(SoundMark soundMark);
        SoundMark SelectSoundMarkById(int id);
        List<SoundMark> SelectSoundMarkByAnyProperty(params object[] parameters);

    }



    public sealed partial class DataAccess
    {
        public static IChineseDict CreateChineseDict()
        {
            string className = path + ".ChineseDictDao";
            object objType = K.EnterpriseLibary.Common.DataCache.GetCache(className); //查看是否有缓存
            if (objType == null)
            {
                try
                {
                    objType = Assembly.Load(path).CreateInstance(className);
                    K.EnterpriseLibary.Common.DataCache.SetCache(className, objType);// 写入缓存
                }
                catch { }
            }
            return (IChineseDict)objType;
        }
    }
}
